


import Vue from "vue"
import {footList} from "."
import {mapState,mapMutations} from "vuex"
import {reg} from "./validate"
Vue.mixin({
    data(){
      return {
          footList:footList,
          reg
      }
    },
    computed:{
      ...mapState(['cartNum','city','cityList','cinemaList','userInfo','goodList','cartList'])
    },
    methods:{
      ...mapMutations([
        'changeCityList',
        'changeCity',
        'changeCinemaList',
        'changeUserInfo',
        'changeGoodList',
        'changeCartList',
        'changecartNum'
      ]),
       gotowhere(name){
         this.$router.push({name})
       },
       getCartList(){  // 购物车的数据  
          this.$ajax.findCart()
          .then(res=>{
             this.changeCartList(res);
             this.changecartNum(res.length)
          })
       },
       checkIsLogin(callback){
         if(this.userInfo){
            callback()
         }else{
            this.$dialog.alert({
              title: '登录提示',
              message: '你尚未登录不能操作,请去登录',
            }).then(() => {
              // on close
              this.$router.push({name:"login"})
            });
         }
       }
    }
})